using System;
using System.IO;
using System.Xml;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//using Microsoft.Web.UI.WebControls;
using Dimok;
using Config = Dimok.Config;
using ConfigWS = Dimok.Config.imaging.WS;
using Dimok.Data;
using Dimok.Data.Database;
using Dimok.Exceptions;
using Dimok.User;

////////////////////////////////////////////////////////////////////////////////////////////////////
// namespace: Dimok.Images
//
// summary:	.
////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Dimok.Images
{
	////////////////////////////////////////////////////////////////////////////////////////////////////
	/// <summary>	Summary description for WebForm1. </summary>
	///
	/// <remarks>	Dimon, 12/21/2010. </remarks>
	////////////////////////////////////////////////////////////////////////////////////////////////////

	public class ImageList : System.Web.UI.Page{
		protected Literal ltrNameSpace;
		protected Literal ltrFiles;
		protected Literal ltrImages;
		protected Literal ltrFolders;
		protected Table tblMain;
		protected HtmlInputText txtApplID;
		protected HtmlTableCell tdFiles;
///		protected Microsoft.Web.UI.WebControls.TreeView tvwFiles;
		protected System.Web.UI.WebControls.Repeater rptFileList;
		
		protected Dimok.User.UserObject uox = new Dimok.User.UserObject();
		private void Page_Load(object sender, System.EventArgs e){

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>	 the try. </summary>
			///
			/// <value>	. </value>
			////////////////////////////////////////////////////////////////////////////////////////////////////

			try{
				DataSet dsImages = Pages.ImageList(uox.db_Images,uox.ApplID0);
				ltrFolders.Text = SQLHelperEx.XmlInnerText(dsImages);
				if( uox.hasApplID || Request["short"] != null ){
					if( uox.hasApplID ){
						txtApplID.Value = uox.applID+"";
						txtApplID.Disabled = true;
					}
					tdFiles.Parent.Controls.Remove(tdFiles);
				}else{
					Trace.Write("Start ImageList");
					try{
						int menuID = uox.menuIDParam;	
						ltrFiles.Text = SQLHelperEx.XmlInnerText(menuID != 0?List.FilesList(menuID):List.FilesList());
					}catch(Exception exc){ ASPException.Publish(exc); }
					ltrNameSpace.Text = Dimok.Config.application.AppSpace;//DDD Config.application.AppSpace;
				}

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// <summary>	Constructor. </summary>
			///
			/// <remarks>	Dimon, 12/21/2010. </remarks>
			///
			/// <param name="exc">	The exc. </param>
			////////////////////////////////////////////////////////////////////////////////////////////////////

			}catch(Exception exc){ throw new ImagingException(exc); }
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		///this.Load += new System.EventHandler(this.Page_Load);
		private void InitializeComponent(){    
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion
	}
}
